# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=s2geometry
pkgver=0.10.0
pkgrel=6
pkgdesc="Computational geometry and spatial indexing on the sphere"
url="https://s2geometry.io/"
# s390x fails endian check
arch="all !s390x"
license="Apache-2.0"
depends_dev="
	abseil-cpp-dev
	openssl-dev>3
	"
makedepends="$depends_dev
	cmake
	gtest-dev
	python3-dev
	samurai
	swig
	"
source="https://github.com/google/s2geometry/archive/v$pkgver/s2geometry-v$pkgver.tar.gz
	fix-newer-openssl.patch
	cxxstd.patch
	"
subpackages="$pkgname-dev py3-$pkgname:_py3"
options="!check" # No test target available

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DBUILD_SHARED_LIBS=ON \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_EXAMPLES=OFF \
		-DWITH_PYTHON=ON
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

_py3() {
	pkgdesc="$pkgdesc (Python)"
	depends="python3"

	amove usr/lib/python3*
}

sha512sums="
04fe955f71b584bca7e492b935ec6061ce1348ff1731797451cdaa538adb88274cb1634d91a844d5d6e3ad0ed11e865322002115d2e746d9a0127f38cabc34e3  s2geometry-v0.10.0.tar.gz
a7b79ce8ec0f45cc6e04925d1530c56126de23b168fc6f5bc22905a8af0006a7aab59dbebf194a5e69bbcf6da9168836e4de775d9cea926ff49e9ebf4471693a  fix-newer-openssl.patch
2b7cc2554be99e7ade879c4697b8fe85346290c402dadf49f5136e4d59ad6c2926d50637464324af5e3b20805a6d028517a0c90cf6b6028249a3360b02997b2a  cxxstd.patch
"
